package models

import "time"

type User struct {
	ID        uint      `gorm:"primaryKey" json:"id"`
	Username  string    `json:"username"`                        //
	Email     string    `json:"email"`                           //
	Password  string    `json:"password"`                        //
	Tel       string    `json:"tel"`                             //
	CreatedAt time.Time `json:"created_at" gorm:"type:datetime"` // 新增的创建时间字段
}

type UserCreateRequest struct {
	Username string `json:"username" binding:"required" example:"john_doe"`
	Password string `json:"password" binding:"required" example:"securepassword123"`
	Email    string `json:"email" binding:"required,email" example:"john@example.com"`
	Tel      string `json:"email" binding:"required,tel" example:"18365895658"`
}

// 通过 TableName() 方法指定表名
func (User) TableName() string {
	return "users" // 直接指定数据库中的表名
}
